import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;


public class OutputStreamDemo {
public static void main(String[]args) throws IOException {
	//byte[] b=new byte[]{97,119,100,123,97,98};
	InputStream in=new FileInputStream("D:\\workspace\\Javaexample7\\src\\1.txt");

	OutputStream out =new FileOutputStream("D:\\workspace\\Javaexample7\\src\\2.txt");
	byte[] b=new byte[4];
	int len =0;
	while(len !=-1){
		len=in.read(b);
		out.write(b,0,len);
	}
	in.close();
	out.close();
	//out.write(b[0]);
	//out.write(b);
	//out.close();
	}
}
